
package client.xmpp;

import org.jivesoftware.smack.packet.IQ;

/**
 * A Ping IQ packet, which is used by XMPP clients to ping server
 * 
 * An example:
 * <pre>
 * // Ping server.
 * Ping pingServer = new Ping();
 * pingServer.setType(IQ.Type.GET);
 * pingServer.setFrom(user);
 * pingServer.setTo("example.com");
 *
 * // Create a packet collector to listen for a response.
 * PacketCollector collector = conn.createPacketCollector(
 *                new PacketIDFilter(pingServer.getPacketID()));
 *
 * con.sendPacket(pingServer);
 *
 * // Wait up to 5 seconds for a result.
 * IQ result = (IQ)collector.nextResult(5000);
 * if (result != null && result.getType() == IQ.Type.RESULT) {
 *       // Do something with result...
 * }
 */
public class PingIQ extends IQ {

    public String getChildElementXML() {
        StringBuilder buf = new StringBuilder();
        buf.append("<ping xmlns='urn:xmpp:ping'/>");
        return buf.toString();
    }
}
